package org.gd.hellojson.jackson;

import org.codehaus.jackson.annotate.JsonAutoDetect;

import java.util.ArrayList;
import java.util.List;

@JsonAutoDetect
public class JacksonUser {
    private int age;
    private String name;
    private List<String> messages;

    public JacksonUser() {
        messages = new ArrayList<String>();
        age = 29;
        name = "mkyong";
        add("msg 1");
        add("msg 2");
        add("msg 3");
    }

    public JacksonUser(int age, String name) {
        this();
        this.age = age;
        this.name = name;
    }

    public boolean add(String str) {
        return messages.add(str);
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public List<String> getMessages() {
        return messages;
    }

    public void setMessages(List<String> messages) {
        this.messages = messages;
    }

    @Override
    public String toString() {
        return "User [age=" + age + ", name=" + name + ", " +
                "messages=" + messages + "]";
    }
}
